package ex1;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class SphereWindow extends Frame{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7221484991822724339L;


	protected class Fermeture extends WindowAdapter{
		public void windowClosing(WindowEvent e){
			System.exit(0);
		}
	}
	private TextField rayon;
	private TextField volume;
	private TextField surface;
	private final static  String title="Application Sphere";
	
	public   SphereWindow(){
		super(title);
		Fermeture maFermeture=new Fermeture();
		this.addWindowListener(maFermeture);
		setLayout(new GridLayout(3,2,10,10));
		Panel p= new Panel();
		Panel p1= new Panel();
		Panel p2= new Panel();
		Panel p3= new Panel();
		Panel p4= new Panel();
		Panel p5= new Panel();
		this.add(p);
		this.add(p1);
		this.add(p2);
		this.add(p3);
		this.add(p4);
		this.add(p5);
		
		p.add(new Label("Radius ="));
		p1.add(rayon= new TextField(""));
		rayon.setPreferredSize(new Dimension(100,30));
		p2.add(new Label("Volume ="));
		p3.add(volume= new TextField(""));
		volume.setPreferredSize(new Dimension(100,30));
		p4.add(new Label("Surface Area ="));
		p5.add( surface=new TextField(""));
		surface.setPreferredSize(new Dimension(100,30));
		SphereControleur sp;
		sp=new SphereControleur(this);
		rayon.addTextListener(sp);
		
		this.pack();
		this.setVisible(true);
		
		
		
		
	}

	public void setRayon(String rayon)
	{
		this.rayon.setText(rayon);
	}
	
	
	public String getRayon()
	{
		return this.rayon.getText();
	}
	public void setVolume(String volume)
	{
		this.volume.setText(volume);
	}


	public void setSurface(String surface)
	{
		this.surface.setText(surface);
	}
	
	

}

